<% content_for :page_title do %>
  <%= page_title %>
<% end %>

<% content_for :page_actions do %>
  <%= button_link_to new_button_text, new_object_url, { icon: 'add.svg', id: 'admin_new_named_type', class: "btn-success" } %>
<% end if can? :create, resource %>

<% if @collection.any? %>
<div class="table-responsive">
  <table class="table" id='listing_named_types' data-hook>
    <thead>
      <tr data-hook="named_types_header">
        <th><%= Spree.t(:name) %></th>
        <th><%= Spree.t(:status) %></th>
        <th></th>
      </tr>
    </thead>
    <tbody id="<%= resource_name.to_s.parameterize.underscore %>">
      <% @collection.each do |named_type| %>
        <tr id="<%= spree_dom_id named_type %>" data-hook="named_type_row">
          <td class="align-center">
            <%= named_type.name %>
          </td>
          <td class="align-center">
            <%= Spree.t(named_type.active? ? :active : :inactive) %>
          </td>
          <td class="actions actions-1 text-right">
            <% if named_type.mutable? %>
              <%= link_to_edit(named_type, no_text: true) if can? :edit, named_type %>
              <%= link_to_delete(named_type, no_text: true) if can? :delete, named_type %>
            <% end %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>
<% else %>
  <div class="alert alert-info no-objects-found">
    <%= Spree.t(:no_resource_found, resource: resource_name) %>,
    <%= link_to(Spree.t(:add_one), new_object_url) if can? :create, resource %>!
  </div>
<% end %>
